%% preparation
ROOTDIR = '..';
MEXBINDIR = [ROOTDIR filesep 'bin'];
[~,~,~] = mkdir(MEXBINDIR);
addpath([ROOTDIR filesep 'common'], MEXBINDIR, [ROOTDIR filesep 'IBP'], fullfile(ROOTDIR, '..', 'daSVM'));

%% hyper-parameters
N = 50; D = 50;
alphav = 4;
sigmax = 1/5;
sigmav = 1;
sigmaz = 1;
poisstrunc = 10;

cachiter = false;

algtype = 2;
maxiter = 1000;
burnin = 10;

%% initialization
Z = ribprnd(N, alphav, @(sz)sigmaz*randn(sz));
V = sigmav*randn(D, size(Z, 2));
X = Z*V' + sigmax*randn(N, D);

Z_init = ribprnd(N, alphav, @(sz)sigmaz*randn(sz));
K = size(Z_init, 2);
V_init = sigmav*randn(D, K);

%% save the results
savedir = input('save to: ', 's');
mkdir(savedir);
save([savedir filesep 'init.mat'], 'Z','V','X','Z_init','K','V_init');